#pragma once

#include "afxlistctrl.h"
#include "ProcessList.h"

// CAttachProcessDlg dialog

class CAttachProcessDlg : public CDialog
{
	DECLARE_DYNAMIC(CAttachProcessDlg)

	class CProcessListCtrl : public CMFCListCtrl {
	public:
		virtual int OnCompareItems(LPARAM p1, LPARAM p2, int col);
	};

public:
	CAttachProcessDlg(CWnd* pParent = NULL);   // standard constructor
	virtual ~CAttachProcessDlg();

// Dialog Data
	enum { IDD = IDD_ATTACHPROCESS };

	ULONG GetSelectedProcessID() const { return m_SelectedProcessID; }
	PROCESSENTRY32* GetSelectedProcessInfo() { return &m_ProcessInfo; }

protected:
	CProcessList m_ProcessListBuilder;
	ULONG m_SelectedProcessID;
	CMFCButton m_OK;
	PROCESSENTRY32 m_ProcessInfo;

	void InitProcesses(bool include_system);

	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support

	DECLARE_MESSAGE_MAP()
	CProcessListCtrl m_ProcessList;
	virtual BOOL OnInitDialog();
	afx_msg void OnLvnItemchangedProcesslist(NMHDR *pNMHDR, LRESULT *pResult);
	virtual void OnOK();
public:
	afx_msg void OnBnClickedShowsystem();
	afx_msg void OnNMDblclkProcesslist(NMHDR *pNMHDR, LRESULT *pResult);
	afx_msg void OnBnClickedRefresh();
};
